using System;
using System.Collections.Generic;
using System.Text;
using System.ServiceModel;

namespace InfFront.UICore
{
    /// <summary>
    /// UICore Info field description interface.
    /// Is used to retrieve the field type, length, title and to get/set it's Info.
    /// </summary>
    [ServiceContract(Namespace = "http://InfFront.UICore")]
    public interface IInfoField
    {
        /// <summary>
        /// Unique (within the InfoSource) field name
        /// </summary>
        [OperationContract]
        string GetName();

        /// <summary>
        /// Field short title.
        /// Is used for labels, column titles and things like that
        /// </summary>
        [OperationContract]
        string GetTitle();

        /// <summary>
        /// Field values type 
        /// </summary>
        [OperationContract]
        IDataType GetType();

        /// <summary>
        /// Is the field for read only
        /// </summary>
        [OperationContract]
        bool GetIsReadOnly();

        /// <summary>
        /// Is the field allowed to be shown in a grid
        /// </summary>
        [OperationContract]
        bool GetIsGridVisible();

        /// <summary>
        /// If the field may have only one of predefined values
        /// </summary>
        [OperationContract]
        bool GetIsEnum();

        /// <summary>
        /// Field order
        /// </summary>
        [OperationContract]
        int GetOrder();

        /// <summary>
        /// Field order within the edit group
        /// </summary>
        [OperationContract]
        int GetEditGroupOrder();

        /// <summary>
        /// Name (within the current InfoSource hierarcy) of an InfoSource to which the field is referenced
        /// </summary>
        [OperationContract]
        string GetReferencedInfoSourceName();

        /// <summary>
        /// Field name within the Referenced InfoSource
        /// </summary>
        [OperationContract]
        string GetReferencedFieldName();

        /// <summary>
        /// Optional field name (from the the Referenced InfoSource) to display it's value instead of Referenced Field
        /// </summary>
        [OperationContract]
        string GetReferencedDisplayFieldName();

        /// <summary>
        /// Field edit group
        /// </summary>
        [OperationContract]
        IInfoFieldGroup GetEditGroup();

        /// <summary>
        /// The enumeration items (if the IsEnum == true)
        /// </summary>
        IEnumerable<IInfoFieldEnumItem> GetEnumValues();
    }

    /// <summary>
    /// IInfoField enumeration interface
    /// </summary>
    [ServiceContract(Namespace = "http://InfFront.UICore")]
    public interface IInfoFieldList : IContainer<IInfoField>
    {
    }

    /// <summary>
    /// IInfoField enumeration items
    /// </summary>
    [ServiceContract(Namespace = "http://InfFront.UICore")]
    public interface IInfoFieldEnumItem
    {
        [OperationContract]
        string GetTitle();

        [OperationContract]
        object GetValue();
    }

    /// <summary>
    /// the IInfoField group descriptor
    /// </summary>
    [ServiceContract(Namespace = "http://InfFront.UICore")]
    public interface IInfoFieldGroup
    {
        /// <summary>
        /// Unique (within the InfoSource) group name
        /// </summary>
        [OperationContract]
        string GetName();

        /// <summary>
        /// Group short title.
        /// Is used for group box titles and things like that
        /// </summary>
        [OperationContract]
        string GetTitle();

        /// <summary>
        /// Group group description
        /// Is used for wizard page infos, tooltips and things like that
        /// </summary>
        [OperationContract]
        string GetComment();

        /// <summary>
        /// Field group order
        /// </summary>
        [OperationContract]
        int GetOrder();
    }
}
